//
//  AccidentsDetection.h
//  BCN Emergencies
//
//  Created by Luis Enrique López Martínez on 15/12/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
//  This class is based on:
//  WreckWatch: Automatic Traffic Accident Detection and Notification with Smartphones
//  written by Jules White, Chris Thompson, Hamilton Turner, Brian Dougherty, and Douglas C. Schmidt
//
//  Original paper can be found on :http://www.google.es/url?sa=t&rct=j&q=wreckwatch%3A&source=web&cd=4&ved=0CEEQFjAD&url=http%3A%2F%2Fwww.dre.vanderbilt.edu%2F~jules%2Fwreckwatchj.pdf&ei=eeHpTp_YBIGG-wbQ-fXXCQ&usg=AFQjCNHrtcwk1RHTc1StUQPqqy-HIdPmcg&sig2=cvnFH9oTm62GSLilnjEIZQ&cad=rja


#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

@protocol AccidentDetectionDelegate <NSObject>

-(void)accidentDetected;

@end

@interface AccidentsDetection : NSObject <UIAccelerometerDelegate, CLLocationManagerDelegate> {
    
    NSTimeInterval * timeIntervalBeforeResetMaximunAcceleration;
    double maxAcceleration;
    NSTimeInterval * timeIntervalSoundRemainsBiggerThanThershold;
    int isSoundBiggerThanThershold; //0: NO 1:YES
    NSTimeInterval * timeIntervalTravelingSlowerThanMST;
    int isTravelingSlowerThanMST; //0: NO 1:YES
    double distanceTraveledSlowerThanMST;
    
    //control properties
    UIAccelerometer *accelerometer;
    CLLocationManager *locationManager;
    
    id<AccidentDetectionDelegate>delegate;
}

@property (nonatomic, strong) CLLocationManager *locationManager;
@property (nonatomic, strong) id<AccidentDetectionDelegate>delegate;

-(void)startTrackingAccidentDetection;
-(BOOL)isAccidentDetected;

@end
